
package com.yuan.adapt;

import com.yuan.prefence.PreferenceKeys;
import com.yuan.view.CheckBoxPreference;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

/**
 * 星期适配器
 * 
 * @author YUAN
 */
public class WeekCheckBoxAdapt extends BaseAdapter {
    Context context = null;

    public WeekCheckBoxAdapt(Context context)
    {
        this.context = context;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return 7;
    }

    @Override
    public Object getItem(int arg0) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public long getItemId(int arg0) {
        // TODO Auto-generated method stub
        return 0;
    }

    /**
     * 改为ViewHolder
     * 
     * @author yuanwei-iri 2014-03-05
     */
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = new CheckBoxPreference(context);
        }
        ((CheckBoxPreference) convertView).setSummary(PreferenceKeys.WEEK[position]);
        ((CheckBoxPreference) convertView).setKey(PreferenceKeys.WEEK[position]);
        return convertView;
    }

}
